<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>{$basic.title}</title>

    <link href="__UI__/css/bootstrap.min.css" rel="stylesheet">
    <link href="__UI__/font-awesome/css/font-awesome.css" rel="stylesheet">

    <link href="__UI__/css/animate.css" rel="stylesheet">
    <link href="__UI__/css/style.css" rel="stylesheet">
    <link href="__UI__/css/toastr.min.css" rel="stylesheet">

</head>

<body class="gray-bg">

    <div class="loginColumns animated fadeInDown">
        <div class="row">

            <div class="col-md-6">
                <h2 class="font-bold">欢迎登录ai_home</h2>

                <p>

            </div>
            <div class="col-md-6">
                <div class="ibox-content">
						<div class="input-group m-b">
						        <input type="text" id="username" class="form-control"  placeholder="账号" required="">
						</div>
						<div class="input-group m-b">
						        <input type="password" id="passwd" class="form-control"  placeholder="密码" required="">
						</div>
						{if condition="$basic.code==1"}
						<div class="input-group m-b">
						        <input type="text" id="captcha" class="form-control"  placeholder="验证码" required="">
						            <div class="input-group-append">
						                <img src="{:url('login/captcha')}" id="captcha_image" alt="captcha" onclick="reCaptcha()" />
						                </div>
						</div>
						{/if}
                        <button type="submit" class="btn btn-primary block full-width m-b">登录</button>

                      <a href="#">
                            <small>忘记密码?</small>
                        </a>

                       <!--  <p class="text-muted text-center">
                            <small>还没有账号?</small>
                        </p>
                        <a class="btn btn-sm btn-white btn-block" href="register.html">创建一个帐户</a>!-->
                    <p class="m-t">
                    </p>
                </div>
            </div>
        </div>
        <hr/>
        <div class="row">
            <div class="col-md-6">
               <small>{$basic.address|default=''}</small>
            </div>
            <div class="col-md-6 text-right">
               {$basic.icp|default=''}
            </div>
        </div>
    </div>
	<script src="__UI__/js/jquery-3.1.1.min.js"></script>
	<script src="__UI__/js/plugins/toastr.min.js"></script>
<script>
	toastr.options = {
	  "closeButton": true,
	  "debug": false,
	  "progressBar": false,
	  "preventDuplicates": false,
	  "positionClass": "toast-top-center",
	  "onclick": null,
	  "showDuration": "800",
	  "hideDuration": "500",
	  "timeOut": "2000",
	  "extendedTimeOut": "500",
	  "showEasing": "swing",
	  "hideEasing": "linear",
	  "showMethod": "fadeIn",
	  "hideMethod": "fadeOut"
	};
    $(function () {
        $(':button').click(function(){
            $.post("{:url('login/auth')}",
					{'username':$('#username').val(),
					'passwd':$('#passwd').val(),
					 'captcha':$('#captcha').val()
				},function(d){
					console.log(d);
					if(d.code == 200){
						toastr.success(d.msg);
						window.location.href = d.url;
					}else{
						toastr.info(d.msg)
						reCaptcha();

					}
            });
        });
    });
	function reCaptcha(){
		$('#captcha_image').attr('src',"{:url('login/captcha')}");
	}
</script>
    <script type="text/javascript">
        (function(){
			var win = window.parent.length;
							if(win > 0 ){
								parent.location.reload()
							}
        })();
    </script>
</body>

</html>
